/**
 * 创元汇 - WebName
 * https://menger.me
 * @大梦
 */

import React, {Component} from 'react'
import {
    Text,
    View,
    Image,
    TextInput,
    ScrollView,
    StyleSheet,
    TouchableOpacity,
    StatusBar,
    WebView,
    Platform
} from 'react-native'
import { StackActions, NavigationActions } from 'react-navigation';
import NetRequest from '../../utils/utilsRequest'
import ServicesApi from '../../constants/ServicesApi'
import GlobalStyles from '../../constants/GlobalStyles'
import NavigationBar from '../../components/common/NavigationBar'
import UtilsView from '../../utils/utilsView'
import { toastShort, toastLong, consoleLog } from '../../utils/utilsToast'

import AlertManager from '../../components/common/AlertManager'
import {Overlay, Label, Button} from 'teaset';


export default class Huiyuan extends Component {

    constructor(props) {
        super(props);
        const { params } = this.props.navigation.state;
        this.state =  {
            user: global.user && global.user.userData ? global.user.userData : '',
            upup: 0
        }
        // this.netRequest = new NetRequest();
    }

    componentDidMount(){
        this.willFocus = this.props.navigation.addListener('willFocus', (payload) => {
            this.getUserInfo();
            this.getInvestData();
        })
    }

    componentWillUnmount(){
        this.willFocus.remove();
        this.onBack();
        
    }

    onBack = () => {
        this.props.navigation.state.params.onCallBack();
        this.props.navigation.goBack();
    }

    updateState= (state) => {
        if (!this) { return };
        this.setState(state);
    }

    getUserInfo = () => {
        let url = ServicesApi.get_member_info;

        let data = {
            member_id: global.user.userData.id,
            token: global.user.userData.token,
        };
        Services.post(url, data, true)
            .then( result => {
                // console.log(result.code);
                if (result && result.code == StatusCode.SUCCESS_CODE) {
                    console.log(result);
                    let user = result.data;

                    storage.save({
                        key: 'loginState',
                        data: user
                    });

                    global.user = {
                        loginState: true,
                        userData: user
                    };

                    this.updateState({
                        upup: 1
                    });

                }else{
                    storage.remove({
                        key: 'loginState',
                    });
                    global.user.loginState = false;
                    global.user.userData = [];
                    setTimeout(() => {
                        toastShort('您的账户信息已过期，请重新登录！')
                        const resetAction = NavigationActions.reset({
                            index: 0,
                            actions: [
                                NavigationActions.navigate({ routeName: 'Login'})
                            ]
                        })
                        this.props.navigation.dispatch(resetAction)
                    }, 101)
                }
            })
            .catch( error => {
                toastShort('服务器请求失败，请稍后重试！');
            })
    }

    getInvestData = () => {
        let url = ServicesApi.get_investor_info;
        let data = {
            member_id: global.user.userData.id,
            token: global.user.userData.token
        }
        Services.post(url, data, true)
            .then( result => {
                if (result && result.code == StatusCode.SUCCESS_CODE) {
                    console.log('result---->', result);
                    let investor_info = result.data;

                    storage.save({
                        key: 'investInfo',
                        data: investor_info
                    });

                    global.invest = {
                        investInfo: investor_info
                    };
                    this.updateState({
                        upup: 1
                    });
                }else{
                    toastLong(result.msg);
                }
            })
            .catch( error => {
                // console.log(error);
                toastShort('服务器请求失败，请稍后重试！');
            })
    }

    onPushNavigator = (compent) => {
        const { navigate } = this.props.navigation;
        navigate( compent , {
            onCallBack:()=>{
                console.log('1');
            }
        })
    }

    _onPressAlert2 = () => {
        const params = {
            title: '温馨提示',
            detail: '您已完成风险测评，点击“继续”进行风险测评问卷的签署',
            actions: [
                { title: '暂不', titleStyle: {  }, actionStyle: {  }, onPress: () => { 
                    
                } },
                { title: '继续', onPress: () => { 
                    let url = ServicesApi.get_url_001;

                    let data = {
                        member_id: global.user.userData.id,
                        token: global.user.userData.token,
                    }
        
                    Services.post(url, data, true)
                        .then( result => {
                            console.log(result);
                            this.pingguAgree(result.data.url, result.data.show_url);
                        })
                        .catch( error => {
                            // consoleLog('链接服务器出错，请稍后重试', error);
                        })
                    
                } }
            ]
        }
        AlertManager.show(params)
    }

    pingguAgree = (shuju, show_link) => {
        let overlayView = (
            <Overlay.PullView side='bottom' modal={false} ref={v => this.overlayView = v}>
                <View style={{backgroundColor: '#fff', width: GlobalStyles.width, height: GlobalStyles.height}}>
                    <WebView
                        startInLoadingState={true}
                        source={{uri: show_link}}
                        style={styles.webContainer}
                    />
                    
                    <View style={styles.botBar}>
                        <TouchableOpacity onPress={()=>{this.overlayView && this.overlayView.close()}} style={styles.botLeft}>
                            <Text style={[styles.botLeftText, {fontSize: 15}]}>取消</Text>
                        </TouchableOpacity>
                        <TouchableOpacity onPress={()=>{this.submit001(shuju);}} style={styles.botRight}>
                            <Text style={styles.botRightText}>同意签署</Text>
                        </TouchableOpacity> 
                    </View>
                </View>
            </Overlay.PullView>
        );
        Overlay.show(overlayView);
    }

    submit001 = (shuju) => {
        let url = ServicesApi.create_pdf;
        let data = {
            url: shuju,
            style: '001',
            id: '',
            member_id: global.user.userData.id,
            token: global.user.userData.token,
        }
        AlertManager.showPopView(<View style={[GlobalStyles.loadingview, GlobalStyles.flexColumnCenter]}><Image source={require('../../assets/images/icons/loading.gif')} style={GlobalStyles.loading} /><Text style={GlobalStyles.loadingtext}>文件生成中，请稍候...</Text></View>, { modal:true })
        Services.post(url, data, true)
        .then( result => {
            console.log(result);
            AlertManager.hide();
            if (result && result.code == StatusCode.SUCCESS_CODE) {
                this.overlayView && this.overlayView.close();
                this.getUserInfo();
            }else{
                toastLong(result.msg);
            }
        })
        .catch( error => {
            // toastShort('服务器请求失败，请稍后重试！');
        })
    }

    _onPressAlert3 = () => {
        const params = {
            title: '温馨提示',
            detail: '尊敬的会员，根据基金业协会管理规定，查阅基金产品信息请先完成特定对象认定程序，系统检测到您已成功签署风险测评问卷，请点击“继续”，进行签署《符合合格投资者标准的承诺书》',
            actions: [
                { title: '暂不', titleStyle: {  }, actionStyle: {  }, onPress: () => { 
                    
                } },
                { title: '继续', onPress: () => { 
                    this.onPushNavigator('RenzhengchengnuoLogin');
                } }
            ]
        }
        AlertManager.show(params)
    }

    _onPressAlert4 = () => {
        const params = {
            title: '温馨提示',
            detail: '尊敬的会员，根据基金业协会管理规定，查阅基金产品信息请先完成特定对象认定程序，系统检测到您已成功签署《符合合格投资者标准的承诺书》，请点击“继续”，进行签署《投资者风险匹配告知书及投资者确认函》。',
            actions: [
                { title: '暂不', titleStyle: {  }, actionStyle: {  }, onPress: () => { 
                    
                } },
                { title: '继续', onPress: () => { 
                    let url = ServicesApi.get_url_003;

                    let data = {
                        member_id: global.user.userData.id,
                        token: global.user.userData.token,
                    }
        
                    Services.post(url, data, true)
                        .then( result => {
                            console.log(result);
                            this.pingguAgree003(result.data.url, result.data.show_url);
                        })
                        .catch( error => {
                            // consoleLog('链接服务器出错，请稍后重试', error);
                        })
                } }
            ]
        }
        AlertManager.show(params)
    }

    pingguAgree003 = (shuju, show_link) => {
        let overlayView = (
            <Overlay.PullView side='bottom' modal={false} ref={v => this.overlayView = v}>
                <View style={{backgroundColor: '#fff', width: GlobalStyles.width, height: GlobalStyles.height}}>
                    <WebView
                        startInLoadingState={true}
                        source={{uri: show_link}}
                        style={styles.webContainer}
                    />
                    
                    <View style={styles.botBar}>
                        <TouchableOpacity onPress={()=>{this.overlayView && this.overlayView.close()}} style={styles.botLeft}>
                            <Text style={[styles.botLeftText, {fontSize: 15}]}>取消</Text>
                        </TouchableOpacity>
                        <TouchableOpacity onPress={()=>{this.submit003(shuju);}} style={styles.botRight}>
                            <Text style={styles.botRightText}>同意签署</Text>
                        </TouchableOpacity> 
                    </View>
                </View>
            </Overlay.PullView>
        );
        Overlay.show(overlayView);
    }

    submit003 = (shuju) => {
        let url = ServicesApi.create_pdf;
        let data = {
            url: shuju,
            style: '003',
            id: '',
            member_id: global.user.userData.id,
            token: global.user.userData.token,
        }
        AlertManager.showPopView(<View style={[GlobalStyles.loadingview, GlobalStyles.flexColumnCenter]}><Image source={require('../../assets/images/icons/loading.gif')} style={GlobalStyles.loading} /><Text style={GlobalStyles.loadingtext}>文件生成中，请稍候...</Text></View>, { modal:true })
        Services.post(url, data, true)
        .then( result => {
            console.log(result);
            AlertManager.hide();
            if (result && result.code == StatusCode.SUCCESS_CODE) {
                if(global.user.userData.is_investor == 0 || global.user.userData.is_investor == -2){
                    const params = {
                        title: '温馨提示',
                        detail: '尊敬的会员，您已成功签署本承诺书，并恭喜完成特定对象认定，点击“继续”，进入专业投资者认定（阅读风险揭示书），点击“返回”，返回基金频道查看基金产品信息。',
                        actions: [
                            { title: '返回', titleStyle: {  }, actionStyle: {  }, onPress: () => { 
                                this.overlayView && this.overlayView.close()
                                this.getUserInfo(global.user.userData.id, global.user.userData.token);
                            } },
                            { title: '继续', onPress: () => { 
                                this.overlayView && this.overlayView.close()
                                this.onPushNavigator('RenzhengTypeLogin');
                            } }
                        ]
                    }
                    AlertManager.show(params)
                }else {
                    this.overlayView && this.overlayView.close()
                }
            }else{
                toastLong(result.msg);
            }
        })
        .catch( error => {
            // toastShort('服务器请求失败，请稍后重试！');
        })
    }

    render(){
        let navigationBar = {
            backgroundColor: '#fff',
            borderBottomColor: '#f2f2f2',
            borderBottomWidth: 1
        }
        return (
            <View style={styles.container}>
                <NavigationBar
                    title = {'会员中心'}
                    style = {navigationBar}
                    titleStyle = {{color: '#333333'}}
                    leftButton = {UtilsView.getLeftBlackButton(() => this.onBack())}
                />
                <StatusBar
                    animated = {true}
                    hidden = {false}
                    backgroundColor = {'transparent'}
                    translucent = {true}
                    barStyle = {'dark-content'}
                />
                <ScrollView>
                <View style={styles.mtop}>
                    <View style={[styles.minfo, GlobalStyles.flexRowStart]}>
                        {global.user.userData.head_img ?
                            <Image source={{uri: global.user.userData.head_img}} style={styles.mtouxiang} />
                        : 
                            <Image source={require('../../assets/images/icons/icon_user_touxiang.png')} style={styles.mtouxiang} />
                        }
                        <Text style={styles.mnicheng}>{global.user.userData.nickname ? global.user.userData.nickname : global.user.userData.account}</Text>
                    </View>
                    {global.user.userData.is_investor == 1 ?
                        <View style={[styles.mshenfen, GlobalStyles.flexColumnCenter]}>
                            <Image source={require('../../assets/images/icons/icon_member_zhuanyetouzizhe.png')} style={styles.msfico} />
                            <Text style={styles.msftext}>专业投资者</Text>
                        </View>
                    : 
                        <View style={[styles.mshenfen, GlobalStyles.flexColumnCenter]}>
                            <Image source={require('../../assets/images/icons/icon_member_putonghuiyuan.png')} style={styles.msfico} />
                            <Text style={styles.msftext}>普通会员</Text>
                        </View>
                    }
                    
                </View>

                <View style={[GlobalStyles.whiteModule, {marginTop: 10}]}>
                    <TouchableOpacity onPress={() => {this.onPushNavigator('Gerenxinxi')}} style={GlobalStyles.userlist}>
                        <View style={GlobalStyles.userlistleft}>
                            <Image source={require('../../assets/images/icons/icon_member_gerenxinxi.png')} style={GlobalStyles.usericon} />
                        </View>
                        <View style={GlobalStyles.userlistright}>
                            <Text style={GlobalStyles.userlisttext}>个人信息</Text>
                            <Image source={require('../../assets/images/icons/icon_user_arrow.png')} style={GlobalStyles.userlistmore} />
                        </View>
                    </TouchableOpacity>
                    
                    {this.pinggu()}
                    {this.invest()}
                    {this.yinhangka()}
                    
                </View>
                </ScrollView>
            </View>
        );
    }

    pinggu = () => {
        if(global.user.userData.is_risk == 1){
            return (
                <View style={GlobalStyles.userlist}>
                    <View style={GlobalStyles.userlistleft}>
                        <Image source={require('../../assets/images/icons/icon_member_fengxianpinggu.png')} style={GlobalStyles.usericon} />
                    </View>
                    <View style={GlobalStyles.userlistright}>
                        <Text style={GlobalStyles.userlisttext}>风险承受能力评估</Text>
                        <Text style={styles.userlistRightText}>已通过</Text>
                        <Image source={require('../../assets/images/icons/icon_user_arrow.png')} style={GlobalStyles.userlistmore} />
                    </View>
                </View>
            )
        }else if(global.user.userData.is_risk == 0) {
            if(global.user.userData.is_risk_answer == 0){
                return (
                    <TouchableOpacity onPress={() => {this.onPushNavigator('Pinggu')}} style={GlobalStyles.userlist}>
                        <View style={GlobalStyles.userlistleft}>
                            <Image source={require('../../assets/images/icons/icon_member_fengxianpinggu.png')} style={GlobalStyles.usericon} />
                        </View>
                        <View style={GlobalStyles.userlistright}>
                            <Text style={GlobalStyles.userlisttext}>风险承受能力评估</Text>
                            <Text style={styles.userlistRightText}>未评估</Text>
                            <Image source={require('../../assets/images/icons/icon_user_arrow.png')} style={GlobalStyles.userlistmore} />
                        </View>
                    </TouchableOpacity>
                )  
            }else{
                if(global.user.userData.new_status == 0){
                    return (
                        <TouchableOpacity onPress={()=>{this._onPressAlert2()}} style={GlobalStyles.userlist}>
                            <View style={GlobalStyles.userlistleft}>
                                <Image source={require('../../assets/images/icons/icon_member_fengxianpinggu.png')} style={GlobalStyles.usericon} />
                            </View>
                            <View style={GlobalStyles.userlistright}>
                                <Text style={GlobalStyles.userlisttext}>风险承受能力评估</Text>
                                <Text style={styles.userlistRightText}>待签署</Text>
                                <Image source={require('../../assets/images/icons/icon_user_arrow.png')} style={GlobalStyles.userlistmore} />
                            </View>
                        </TouchableOpacity>
                    ) 
                }else if(global.user.userData.new_status == 1){
                    return (
                        <TouchableOpacity onPress={()=>{this._onPressAlert3()}} style={GlobalStyles.userlist}>
                            <View style={GlobalStyles.userlistleft}>
                                <Image source={require('../../assets/images/icons/icon_member_fengxianpinggu.png')} style={GlobalStyles.usericon} />
                            </View>
                            <View style={GlobalStyles.userlistright}>
                                <Text style={GlobalStyles.userlisttext}>风险承受能力评估</Text>
                                <Text style={styles.userlistRightText}>待签署</Text>
                                <Image source={require('../../assets/images/icons/icon_user_arrow.png')} style={GlobalStyles.userlistmore} />
                            </View>
                        </TouchableOpacity>
                    )
                }else if(global.user.userData.new_status == 2){
                    return (
                        <TouchableOpacity onPress={()=>{this._onPressAlert4()}} style={GlobalStyles.userlist}>
                            <View style={GlobalStyles.userlistleft}>
                                <Image source={require('../../assets/images/icons/icon_member_fengxianpinggu.png')} style={GlobalStyles.usericon} />
                            </View>
                            <View style={GlobalStyles.userlistright}>
                                <Text style={GlobalStyles.userlisttext}>风险承受能力评估</Text>
                                <Text style={styles.userlistRightText}>待签署</Text>
                                <Image source={require('../../assets/images/icons/icon_user_arrow.png')} style={GlobalStyles.userlistmore} />
                            </View>
                        </TouchableOpacity>
                    )
                }
            }
        }
    }


    invest = () => {
        if(global.user.userData.is_risk == 1){
            if(global.user.userData.is_investor == -2){
                global.invest.investInfo.editable = true;
                return (
                    <TouchableOpacity onPress={() => {this.onPushNavigator('RenzhengType');toastShort(global.user.userData.back_msg)}} style={[GlobalStyles.userlist]}>
                        <View style={GlobalStyles.userlistleft}>
                            <Image source={require('../../assets/images/icons/icon_user_huiyuan.png')} style={GlobalStyles.usericon} />
                        </View>
                        <View style={GlobalStyles.userlistright}>
                            <Text style={[GlobalStyles.userlisttext]}>专业投资者认证</Text>
                            <Text style={[styles.userlistRightText, {color: '#f00'}]}>{global.user.userData.investor_msg}</Text>
                            <Image source={require('../../assets/images/icons/icon_user_arrow.png')} style={GlobalStyles.userlistmore} />
                        </View>
                    </TouchableOpacity>
                )
            }else if(global.user.userData.is_investor == -1){
                global.invest.investInfo.editable = true;
                return (
                    <TouchableOpacity onPress={() => {this.onPushNavigator('RenzhengType',global.user.userData.back_msg)}} style={[GlobalStyles.userlist]}>
                        <View style={GlobalStyles.userlistleft}>
                            <Image source={require('../../assets/images/icons/icon_user_huiyuan.png')} style={GlobalStyles.usericon} />
                        </View>
                        <View style={GlobalStyles.userlistright}>
                            <Text style={[GlobalStyles.userlisttext]}>专业投资者认证</Text>
                            <Text style={[styles.userlistRightText, {color: '#f00'}]}>{global.user.userData.investor_msg}</Text>
                            <Image source={require('../../assets/images/icons/icon_user_arrow.png')} style={GlobalStyles.userlistmore} />
                        </View>
                    </TouchableOpacity>
                )
            }else if(global.user.userData.is_investor == 0){
                global.invest.investInfo.editable = true;
                return (
                    <TouchableOpacity onPress={() => {this.onPushNavigator('RenzhengType')}} style={[GlobalStyles.userlist]}>
                        <View style={GlobalStyles.userlistleft}>
                            <Image source={require('../../assets/images/icons/icon_user_huiyuan.png')} style={GlobalStyles.usericon} />
                        </View>
                        <View style={GlobalStyles.userlistright}>
                            <Text style={[GlobalStyles.userlisttext]}>专业投资者认证</Text>
                            <Text style={styles.userlistRightText}>{global.user.userData.investor_msg}</Text>
                            <Image source={require('../../assets/images/icons/icon_user_arrow.png')} style={GlobalStyles.userlistmore} />
                        </View>
                    </TouchableOpacity>
                )
            }else if(global.user.userData.is_investor == 1){
                global.invest.investInfo.editable = false;
                return (
                    <TouchableOpacity onPress={() => {this.onPushNavigator('Renzheng');toastShort(global.user.userData.back_msg)}} style={[GlobalStyles.userlist]}>
                        <View style={GlobalStyles.userlistleft}>
                            <Image source={require('../../assets/images/icons/icon_user_huiyuan.png')} style={GlobalStyles.usericon} />
                        </View>
                        <View style={GlobalStyles.userlistright}>
                            <Text style={[GlobalStyles.userlisttext]}>专业投资者认证</Text>
                                <Text style={styles.userlistRightText}>{global.user.userData.investor_msg}</Text>
                            <Image source={require('../../assets/images/icons/icon_user_arrow.png')} style={GlobalStyles.userlistmore} />
                        </View>
                    </TouchableOpacity>
                )
            }else if(global.user.userData.is_investor == 2){
                global.invest.investInfo.editable = false;
                return (
                    <TouchableOpacity onPress={() => {this.onPushNavigator('Renzheng');toastShort(global.user.userData.back_msg)}} style={[GlobalStyles.userlist]}>
                        <View style={GlobalStyles.userlistleft}>
                            <Image source={require('../../assets/images/icons/icon_user_huiyuan.png')} style={GlobalStyles.usericon} />
                        </View>
                        <View style={GlobalStyles.userlistright}>
                            <Text style={[GlobalStyles.userlisttext]}>专业投资者认证</Text>
                            <Text style={[styles.userlistRightText, {color: '#f00'}]}>{global.user.userData.investor_msg}</Text>
                            <Image source={require('../../assets/images/icons/icon_user_arrow.png')} style={GlobalStyles.userlistmore} />
                        </View>
                    </TouchableOpacity>
                )
            }
        }else if(global.user.userData.is_risk == 0) {
            if(global.user.userData.is_risk_answer == 0){
                return (
                    <TouchableOpacity onPress={() => {this.onPushNavigator('Pinggu'); toastShort('请先进行特定对象认定')}} style={GlobalStyles.userlist}>
                        <View style={GlobalStyles.userlistleft}>
                            <Image source={require('../../assets/images/icons/icon_user_huiyuan.png')} style={GlobalStyles.usericon} />
                        </View>
                        <View style={GlobalStyles.userlistright}>
                            <Text style={GlobalStyles.userlisttext}>专业投资者认证</Text>
                            <Text style={styles.userlistRightText}>待认证</Text>
                            <Image source={require('../../assets/images/icons/icon_user_arrow.png')} style={GlobalStyles.userlistmore} />
                        </View>
                    </TouchableOpacity>
                )  
            }else{
                if(global.user.userData.new_status == 0){
                    return (
                        <TouchableOpacity onPress={()=>{this._onPressAlert2()}} style={GlobalStyles.userlist}>
                            <View style={GlobalStyles.userlistleft}>
                                <Image source={require('../../assets/images/icons/icon_user_huiyuan.png')} style={GlobalStyles.usericon} />
                            </View>
                            <View style={GlobalStyles.userlistright}>
                                <Text style={GlobalStyles.userlisttext}>专业投资者认证</Text>
                                <Text style={styles.userlistRightText}>待认证</Text>
                                <Image source={require('../../assets/images/icons/icon_user_arrow.png')} style={GlobalStyles.userlistmore} />
                            </View>
                        </TouchableOpacity>
                    ) 
                }else if(global.user.userData.new_status == 1){
                    return (
                        <TouchableOpacity onPress={()=>{this._onPressAlert3()}} style={GlobalStyles.userlist}>
                            <View style={GlobalStyles.userlistleft}>
                                <Image source={require('../../assets/images/icons/icon_user_huiyuan.png')} style={GlobalStyles.usericon} />
                            </View>
                            <View style={GlobalStyles.userlistright}>
                                <Text style={GlobalStyles.userlisttext}>专业投资者认证</Text>
                                <Text style={styles.userlistRightText}>待认证</Text>
                                <Image source={require('../../assets/images/icons/icon_user_arrow.png')} style={GlobalStyles.userlistmore} />
                            </View>
                        </TouchableOpacity>
                    )
                }else if(global.user.userData.new_status == 2){
                    return (
                        <TouchableOpacity onPress={()=>{this._onPressAlert4()}} style={GlobalStyles.userlist}>
                            <View style={GlobalStyles.userlistleft}>
                                <Image source={require('../../assets/images/icons/icon_user_huiyuan.png')} style={GlobalStyles.usericon} />
                            </View>
                            <View style={GlobalStyles.userlistright}>
                                <Text style={GlobalStyles.userlisttext}>专业投资者认证</Text>
                                <Text style={styles.userlistRightText}>待认证</Text>
                                <Image source={require('../../assets/images/icons/icon_user_arrow.png')} style={GlobalStyles.userlistmore} />
                            </View>
                        </TouchableOpacity>
                    )
                }
            }
        }
    }

    yinhangka = () => {
        if(global.user.userData.is_risk == 1){
            if(global.user.userData.is_pay_auth == -1){
                if(global.user.userData.is_investor == 0){
                    return (
                        <TouchableOpacity onPress={() => {toastShort(global.user.userData.is_pay_auth_msg);this.onPushNavigator('RenzhengType')}} style={GlobalStyles.userlist}>
                            <View style={GlobalStyles.userlistleft}>
                                <Image source={require('../../assets/images/icons/icon_member_yinhangka.png')} style={GlobalStyles.usericon} />
                            </View>
                            <View style={GlobalStyles.userlistright}>
                                <Text style={GlobalStyles.userlisttext}>银行卡</Text>
                                <Text style={styles.userlistRightText}>{global.user.userData.is_bank_card == 1 ? '已绑定' : '未绑定'}</Text>
                                <Image source={require('../../assets/images/icons/icon_user_arrow.png')} style={GlobalStyles.userlistmore} />
                            </View>
                        </TouchableOpacity>
                    )
                }else{
                    return (
                        <TouchableOpacity onPress={() => {toastShort(global.user.userData.is_pay_auth_msg);}} style={GlobalStyles.userlist}>
                            <View style={GlobalStyles.userlistleft}>
                                <Image source={require('../../assets/images/icons/icon_member_yinhangka.png')} style={GlobalStyles.usericon} />
                            </View>
                            <View style={GlobalStyles.userlistright}>
                                <Text style={GlobalStyles.userlisttext}>银行卡</Text>
                                <Text style={styles.userlistRightText}>{global.user.userData.is_bank_card == 1 ? '已绑定' : '未绑定'}</Text>
                                <Image source={require('../../assets/images/icons/icon_user_arrow.png')} style={GlobalStyles.userlistmore} />
                            </View>
                        </TouchableOpacity>
                    )
                }
            }else{
                return (
                    <TouchableOpacity onPress={() => {this.onPushNavigator('Yinhangka')}} style={GlobalStyles.userlist}>
                        <View style={GlobalStyles.userlistleft}>
                            <Image source={require('../../assets/images/icons/icon_member_yinhangka.png')} style={GlobalStyles.usericon} />
                        </View>
                        <View style={GlobalStyles.userlistright}>
                            <Text style={GlobalStyles.userlisttext}>银行卡</Text>
                            <Text style={styles.userlistRightText}>{global.user.userData.is_bank_card == 1 ? '已绑定' : '未绑定'}</Text>
                            <Image source={require('../../assets/images/icons/icon_user_arrow.png')} style={GlobalStyles.userlistmore} />
                        </View>
                    </TouchableOpacity>
                )
            }
        }else if(global.user.userData.is_risk == 0) {
            if(global.user.userData.is_risk_answer == 0){
                return (
                    <TouchableOpacity onPress={() => {this.onPushNavigator('Pinggu'); toastShort('请先进行特定对象认定')}} style={GlobalStyles.userlist}>
                        <View style={GlobalStyles.userlistleft}>
                            <Image source={require('../../assets/images/icons/icon_member_yinhangka.png')} style={GlobalStyles.usericon} />
                        </View>
                        <View style={GlobalStyles.userlistright}>
                            <Text style={GlobalStyles.userlisttext}>银行卡</Text>
                            <Text style={styles.userlistRightText}>未绑定</Text>
                            <Image source={require('../../assets/images/icons/icon_user_arrow.png')} style={GlobalStyles.userlistmore} />
                        </View>
                    </TouchableOpacity>
                )  
            }else{
                if(global.user.userData.new_status == 0){
                    return (
                        <TouchableOpacity onPress={()=>{this._onPressAlert2()}} style={GlobalStyles.userlist}>
                            <View style={GlobalStyles.userlistleft}>
                                <Image source={require('../../assets/images/icons/icon_member_yinhangka.png')} style={GlobalStyles.usericon} />
                            </View>
                            <View style={GlobalStyles.userlistright}>
                                <Text style={GlobalStyles.userlisttext}>银行卡</Text>
                                <Text style={styles.userlistRightText}>未绑定</Text>
                                <Image source={require('../../assets/images/icons/icon_user_arrow.png')} style={GlobalStyles.userlistmore} />
                            </View>
                        </TouchableOpacity>
                    ) 
                }else if(global.user.userData.new_status == 1){
                    return (
                        <TouchableOpacity onPress={()=>{this._onPressAlert3()}} style={GlobalStyles.userlist}>
                            <View style={GlobalStyles.userlistleft}>
                                <Image source={require('../../assets/images/icons/icon_member_yinhangka.png')} style={GlobalStyles.usericon} />
                            </View>
                            <View style={GlobalStyles.userlistright}>
                                <Text style={GlobalStyles.userlisttext}>银行卡</Text>
                                <Text style={styles.userlistRightText}>未绑定</Text>
                                <Image source={require('../../assets/images/icons/icon_user_arrow.png')} style={GlobalStyles.userlistmore} />
                            </View>
                        </TouchableOpacity>
                    )
                }else if(global.user.userData.new_status == 2){
                    return (
                        <TouchableOpacity onPress={()=>{this._onPressAlert4()}} style={GlobalStyles.userlist}>
                            <View style={GlobalStyles.userlistleft}>
                                <Image source={require('../../assets/images/icons/icon_member_yinhangka.png')} style={GlobalStyles.usericon} />
                            </View>
                            <View style={GlobalStyles.userlistright}>
                                <Text style={GlobalStyles.userlisttext}>银行卡</Text>
                                <Text style={styles.userlistRightText}>未绑定</Text>
                                <Image source={require('../../assets/images/icons/icon_user_arrow.png')} style={GlobalStyles.userlistmore} />
                            </View>
                        </TouchableOpacity>
                    )
                }
            }
        }
    }



}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        backgroundColor: GlobalStyles.bgColor,
    },
    webContainer: {
        width: GlobalStyles.width,
        height: GlobalStyles.height,
        flex: 1,
        backgroundColor: '#fff',
        marginTop: Platform.OS === 'ios' ? -15 : 0,
    },
    mtop: {
        backgroundColor: GlobalStyles.themeColor,
        height: 160,
        padding: 15,
    },
    minfo: {
        height: 30,
    },
    mtouxiang: {
        width: 32,
        height: 32,
        marginRight: 6,
        borderRadius: 16,
    },
    mnicheng: {
        fontSize: 15,
        color: '#fff',
        fontWeight: 'bold'
    },
    mshenfen: {
        backgroundColor: '#fff',
        marginTop: 15,
        borderTopLeftRadius: 5,
        borderTopRightRadius: 5,
        height: 100,
        width: GlobalStyles.width - 30,
    },
    msfico: {
        height: (GlobalStyles.width-80)*96/1251,
        width: GlobalStyles.width-80,
        marginTop: 15
    },
    msftext: {
        fontSize: 16,
        color: GlobalStyles.themeColor,
        fontWeight: 'bold',
        marginTop: 13
    },
    userlistRightText: {
        position: 'absolute',
        right: 20,
        color: '#585858',
    },
    botBar: {
        height: 54,
        backgroundColor: '#fff',
        display: 'flex',
        flexDirection: 'row',
        justifyContent: 'center',
        alignItems: 'center',
        borderTopColor: '#ececec',
        borderTopWidth: 1,

    },
    botLeft: {
        height: 54,
        flex: 1,
        display: 'flex',
        flexDirection: 'column',
        justifyContent: 'center',
        alignItems: 'center'
    },
    botLeftIco: {
        height: 24,

    },
    botLeftText: {
        fontSize: 13,
        color: '#666',
        height: 20,
        lineHeight: 20,
    },
    botRight: {
        flex: 2.5,
        backgroundColor: GlobalStyles.themeColor,
        height: 54,
        justifyContent: 'center',
        alignItems: 'center',

    },
    botRightText: {
        color: '#fff',
        fontSize: 18,
        fontWeight: 'bold'
    },
});
